1. Field of the Invention
The present invention relates to an image processing device that accepts color image data expressed with arrays of pixels and executes a logical operation.
2. Description of Related Art
Various images are processed in an image processing device that processes various image data transmitted from image creating devices such as a personal computer and the like, and expands them into image data expressed with arrays of pixels that can be printed by a printer. As an example, when a plurality of picture images are mapped to be overlapped, there is processing that interprets a logical operation code to specify a method of superposing a newly written image upon an original image, executes a logical operation according to the method specified in the logical operation code, and superposes the images. This type of logical operation is generally known as the ROP (Raster OPeration) processing.
Originally, this ROP processing was devised for display on a display device of a personal computer or the like, and pixel data for the logical operation is premised to be expressed with the RGB color space. However, printers in general employ the CMYK color space finally, which is different from the space that the ROP processing premises. The ROP processing cannot be performed correctly with the color space that is not primary-independent, such that the K color component is dependent upon the other color components C, M, Y, as the CMYK color space. Accordingly, the execution of the ROP processing to the pixels expressed with the CMYK color space will lead to a result different from the case of the execution to the pixels of the RGB color space.
In view of this, as a method for correctly executing the ROP processing, for example, the following one is known. First, the ROP processing is executed while the image data expressed with the RGB color space is expanded into the pixel data of the RGB color space as it is. And, after the image data in one page is all expanded into the pixel data and the ROP processing is completed, the pixels for one page are converted all together into the CMYK color space. But, this method requires the color conversion of the pixel data expressed with the RGB color space into the pixel data of the CMYK color space all in a pixel unit. As a result, it requires a great amount of time for the color conversion. Moreover, the method will necessarily apply uniform color conversion to the image data, regardless of the types of the image data that the original plotting command indicates. Therefore, it is impossible to select color conversion parameters suited to the types of the image data, which induces the problem of picture quality.
In contrast to this method, the image processing device disclosed, for example, in the Japanese Published Unexamined Patent Application No. Hei 10-51651 employs a method that applies the ROP processing after converting the image data once expanded into the pixel data of the CMYK color space into the CMY color space only for the part that requires the ROP processing, and thereafter converts only the part converted into the CMY color space again into the CMYK color space. According to this method, a higher-speed processing can be expected in comparison to the above-mentioned method that once expands the image data into the pixel data of the RGB color space, and converts all the expanded pixel data into the CMYK color space. Also, this method enables a correct ROP processing, compared to the case of processing the pixel data of the CMYK color space as it is.
FIG. 6 is a flowchart to illustrate one operation example in the conventional image processing device. In this case, as described in the aforementioned document, the objects converted into the CMYK color space are checked to see whether the objects each need the ROP processing, and only when necessary, converted into the CMY color space to have the ROP processing applied, and thereafter again converted into the CMYK color space. As mentioned above, since the ROP processing cannot be correctly executed with the color space that is not primary-independent as the CMYK color space, the objects are converted once into the CMYK color space to have the ROP processing applied.
Incidentally, the objects may be converted once into the RGB color space from the CMYK color space to have the ROP processing applied. And, specially in this case, the flow of the processing is illustrated which plots to input the logical operation code indicating what kind of logical operation is executed with the color values of the CMYK color space at the position of a point (X, Y) in the coordinate system that assumes the horizontal direction and the vertical direction of the image for one page as X axis and Y axis, respectively.
At step S51, the coordinate, color values, and logical operation code of plotting data are inputted. The coordinate is substituted for the variables X and Y, the color values for the variable P, and the logical operation code for the variable C. If there is not specification of the logical operation code, a code indicating xe2x80x9chaving no specificationxe2x80x9d is substituted for the variable C.
At step S52, the judgment is made as to whether the ROP processing is necessary. This judgment checks whether the variable C is the code indicating xe2x80x9chaving no specificationxe2x80x9d. If the ROP processing is judged necessary, the process moves to step S54. And, if it is judged not necessary, the process moves to step S53, where the inputted color data of the CMYK color space stored in the variable P is stored as it is in the area including the position specified by the values of the variables X and Y.
If the ROP processing is necessary, first at step S54, a destination information is acquired. That is, the color data of the CMYK color space is loaded from the area including the position specified by the values of the variables X and Y, and substituted for the variable Q.
Next, at step S55, the color conversion from the CMYK color space into the CMY color space is executed. That is, the values of the variable P representing the color data of the CMYK color space inputted at step S51 are converted into the color data of the CMY color space, and overwritten on the variable P and substituted for it. In the same manner, the values of the variable Q representing the color data of the CMYK color space in the destination information acquired at step S54 are converted into the color data of the CMY color space, and overwritten on the variable Q and substituted for it.
And, at step S56, the ROP processing is executed. First, the type of an actual operation is determined from the values of the variable C representing the logical operation code. The logical operation determined as above is executed between the color components of the variable P representing the color data of the CMY color space in the input data and the variable Q representing the color data of the CMY color space in the destination information. The result is overwritten on the variable P and substituted for it.
At step S57, the color data of the CMY color space stored in the variable P being an operation result is converted into the color data of the CMYK color space, and overwritten on the variable P to be substituted for it. And, at step S53, the color data of the CMYK color space stored in the variable P is stored in the area including the position specified by the values of the variables X and Y. Thus, the ROP processing to the input data is terminated.
FIG. 7 is a chart to explain a concrete example of the images before and after the processing in one operational example of the conventional image processing device. The logical operation of AND is made between the bit map image having the character shape xe2x80x98Axe2x80x99 shown in FIG. 7A and the background image shown in FIG. 7B. The bit map image expressing xe2x80x98Axe2x80x99 shown in FIG. 7A is a rectangular bit map image, and the character part of xe2x80x98Axe2x80x99 is expressed with a color a and the background part is expressed with a color b. The color a is a color such that all the values of each color components in the CMYK color space are xe2x80x980xe2x80x99, that is, it represents white. The color b is a color such that the values of each color components of C, M, Y are xe2x80x980xe2x80x99 and the value of K component is xe2x80x98255xe2x80x99, that is, it represents black. All the values of C, M, Y color components of these colors a and b become xe2x80x980xe2x80x99 and xe2x80x98255xe2x80x99, respectively, by the color conversion from the CMYK color space into the CMY color space.
The background image shown in FIG. 7B is a gradation image in which the color varies from color c to color g. In the rectangular frames in the drawing, the bit map image shown in FIG. 7A is to be superposed. For the convenience of illustration, the differences of the colors are shown with the differences of the hatching.
The logical operation AND with the value xe2x80x980xe2x80x99 always results in xe2x80x980xe2x80x99, and the operation AND with the value xe2x80x98255xe2x80x99 always results in maintaining the original value. Thus, as for the result by the logical operation AND to the bit map image of the CMY color space expressing the character xe2x80x98Axe2x80x99, all the values of the color components C, M, Y always become xe2x80x980xe2x80x99 in the character part xe2x80x98Axe2x80x99. And, the background part assumes the original background value. This logical operation AND produces an image such that the white character xe2x80x98Axe2x80x99 is mapped on the background image shown in FIG. 7B. And, the gradation from the color c to the color g is to be applied to the peripheral parts of the character xe2x80x98Axe2x80x99 with the original background image as it is.
However in reality, as shown in FIG. 7C, although the white character xe2x80x98Axe2x80x99 is definitely acquired, on the surroundings to the character xe2x80x98Axe2x80x99 inside the rectangular area to which the ROP processing is applied, the color varies in the gradation from the color h to the color l, which results in not being coincident with the gradation from the color c to the color g. In this manner, there occurs a color difference between the area where the ROP processing is executed and the part where the ROP processing is not executed, which is a problem to be solved.
Next, why the background color differs as above will be discussed. Theoretically, the ROP processing in the CMY color space that does not include the K (Chinese ink) component will produce a result equivalent to that in case of the ROP processing in the RGB color space. But, the pixel values once converted into the CMYK color space cannot accurately restore the original pixel values of the CMY color space in one-to-one correspondence to the pixel values of the RGB color space. Also, in case of restoring from the CMYK color space to the RGB color space, the pixel values will differ form the original ones of the RGB color space.
The reason lies in that the conversion from the RGB color space to the CMYK color space does not necessarily correspond one to one, namely, this conversion is irreversible. In the printer, for example, the color conversion coefficients are determined in conformity with the characteristics of the output device connected thereto. For example, where the output device has the characteristic such that it outputs C (cyan) color component with a slightly dark color, a coefficient such that the C color component is converted into the values of a slightly reserved color is selected. Thus, in the conversion from the RGB color space into the CMYK color space, a plotting command including the original pixels varies the coefficient in the color conversion in accordance with the types of plotting objects to be expressed, for example, the raster images, characters, geometrical graphics, and the like, thereby enhancing the picture quality of the images. But, once expanded into the pixel values of the CMYK color space, they have lost the information regarding the types of the objects; accordingly, it is impossible to reconvert by means of the coefficient used for the conversion from the RGB color space into the CMYK color space. In other words, the color conversion from the RGB color space into the CMYK color space in general is irreversible conversion. Therefore, the pixel values converted in reverse from the CMYK color space into the CMY color space, or from the CMYK color space into the RGB color space will be different from the ones the original plotting command intends. Similarly, the color conversion between the CMYK color space and the CMY color space does not correspond one to one, and there occurs a case where the color conversion cannot be determined uniquely.
Thus, when the images of the CMYK color space are converted into the CMY color space, and converted in reverse into the CMYK color space, it is not guaranteed to restore the original values. Accordingly, when the area necessary for the ROP processing of the images once expanded into the pixels of the CMYK color space is reverse-converted into the CMY color space to have the ROP processing applied, and thereafter, reconverted into the pixels of the CMYK color space, this series of the processing will produce the pixel values different from the ones acquired when the ROP processing is applied to the images during expanding them into the pixels with the RGB color space, and thereafter the color conversion is executed to each of the pixels.
Further, as also illustrated in FIG. 7, many cases show that the data written afterward in the ROP processing is the raster images. Here, the plotting command normally intends to vary the pixel values of a part with the ROP processing, but many cases confirm that the part is, as the character xe2x80x98Axe2x80x99 in FIG. 7, a part of the rectangular area, specially an area of an arbitrary shape that is inscribed or contained in the rectangular area. In this case, in the surroundings of the rectangular area being the objects of the ROP processing except for the graphics inscribed or contained therein, it is beyond intention that the pixel values vary before and after the ROP processing. However, the conventional method disclosed in the foregoing document will vary the pixel values of the surroundings due to the irreversibility during the color conversion, as shown in FIG. 7C, which is not intended and desirable. Accordingly, the boundary between the rectangular area having the ROP processing applied and the area in the surroundings thereof not having the ROP processing applied appears on a printed image as a clear difference of the color or density against the original intention of the plotting command, which is the problem to be solved. Specially, the part where the difference of the color or density is clearly seen is, as shown in FIG. 7, where the ROP operation is executed, but the color values do not vary from the original ones of the background image.
The present invention has been made in view of the foregoing circumstances, and it is an object of the present invention to provide an image processing device that makes it possible to avoid the occurrence of unintended color conversion during the logical operation, and to acquire a high-resolution image.
In the image processing device according to the present invention, the first image data expressed with the first color space are converted into the second image data expressed with the second color space where the logical operation is conducted, before the logical operation is executed. And, the operation results are converted into the third image data expressed with the first color space. The pixel value comparison part compares the pixel values of the second color space before and after the logical operation. In accordance with the comparison result, the output image selection part selects either the first image data or the third image data of the first color space.
For example, after the first image data expressed with the CMYK color space is converted into the second image data expressed with the CMY color space, the logical operation is executed, and the image data is converted again into the third image data expressed with the CMYK color space. The pixel values of the CMY color space before and after the logical operation are compared, and if coincident, the first image data of the CMYK color space is selected.
As discussed above, after the conversion into the CMY color space for the logical operation, the reconversion into the CMYK color space will not necessarily restore the original color. However in the present invention, as to the pixels without variations of pixel values by the logical operation, the first image data is outputted which has not been subjected to the color conversion into the CMY color space. Thereby, the conversion and reconversion of the color space will not create variations of colors, and there will not appear unintended variations of colors, thus producing high-resolution images.